package models

import (
	"errors"
	"github.com/xgggh/test/api/entity"
	"github.com/xgggh/test/api/db"
	"github.com/astaxie/beego/orm"
)

var (
	//Tasks map[string]*entity.Task
)

var mMaster orm.Ormer
func init() {
	mMaster=db.Master();
}

func AddOne(task entity.Task) (taskId int64,err error) {
	id,err:=mMaster.Insert(&task)
	task.Id=id
	return task.Id,err
}

func GetOne(taskId int64) (object *entity.Task, err error) {
	mMaster.Read(taskId)
	return nil, errors.New("ObjectId Not Exist")
}

func GetAll() map[string]*entity.Task {
	return nil
}

func Update(TaskId int64, Score int64) (err error) {

	return errors.New("ObjectId Not Exist")
}

func Delete(TaskId int64) {

}

